//
//  YGScienceCenterView.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/3/22.
//

#import "YGScienceCenterView.h"

@interface YGScienceCenterView ()


@property (nonatomic, strong)UILabel *scienceLable;
@property(nonatomic, strong)UIImageView *scienceImage;

@end
@implementation YGScienceCenterView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initContraints];
    }
    return self;
}

- (void)initView{
    
    [self addSubview:self.scienceBtn];
    [self addSubview:self.scienceLable];
    [self addSubview:self.scienceImage];
}


- (void)initContraints{
    
    [self.scienceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top);
        make.left.mas_equalTo(self.mas_left);
        make.width.mas_equalTo(self.mas_width);
        make.height.mas_equalTo(self.mas_height);
    }];
    
    [self.scienceLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_top).offset(15);
            make.left.mas_equalTo(self.mas_left).offset(10);
            make.width.mas_equalTo(100);
            make.height.mas_equalTo(16);
            
    }];
    
    [self.scienceImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.mas_centerY);
            make.right.mas_equalTo(self.mas_right).offset(-20);
            make.height.mas_equalTo(65);
            make.width.mas_equalTo(75);
        
        
            
    }];
}

-(void)clickInfoScienceAction{
    if (self.scienceViewDelegate != nil && [self.scienceViewDelegate respondsToSelector:@selector(scienceViewInfoScienceControllerAction)]) {
        [self.scienceViewDelegate scienceViewInfoScienceControllerAction];
    }
}


#pragma setter

- (UIButton *)scienceBtn{
    if (!_scienceBtn) {
        _scienceBtn=[[UIButton alloc]init];
        [_scienceBtn addTarget:self action:@selector(clickInfoScienceAction) forControlEvents:UIControlEventTouchUpInside];
        _scienceBtn.backgroundColor=UIColorFromRGB(0xD9FFF3);
        _scienceBtn.layer.cornerRadius=5;
        
    }
    return _scienceBtn;
}

- (UILabel *)scienceLable{
    if (!_scienceLable) {
        _scienceLable=[[UILabel alloc]init];
        _scienceLable.text=@"科普中心";
        _scienceLable.textColor=UIColorFromRGB(0x25E1A6);
        _scienceLable.font=[UIFont fontWithName:@"Helvetica-Bold" size:16];
        
    }
    return _scienceLable;
}

- (UIImageView *)scienceImage{
    if (!_scienceImage) {
        _scienceImage= [[UIImageView alloc]init];
        [_scienceImage setImage:[UIImage imageNamed:@"science_cen_icon"]];
    }
    return _scienceImage;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


@end
